public with sharing class ContactDetails 
{	
    public Set<String>errors;
    
    public ContactDetails()
    {
        this.errors = new Set<String>();
        this.contactDuringBusinessHours = 'Yes';
        this.postcode = EnquiryController.DEFAULT_POSTCODE;
        this.desiredSuburb = EnquiryController.DEFAULT_SUBURB;
    }
    
    public String[] getErrors()
    {
        String[] errors = new String[this.errors.size()];
        Integer i = 0;
        for(String error : this.errors) 
        {       
            errors[i] = error;
            i++;
        }
        return errors;
    }
    
    public boolean getHasValidationErrors()
    {
        return !this.errors.isEmpty();
    }
    
    public String franchiseWebSource {get;set;}
    
    public String franchiseOfInterest {get;set;}
    
    public String franchiseOfInterestFreeText {get;set;}
    
    public String firstName {get;set;}
    
    public String surname {get;set;}
    
    public String email {get;set;}
    
    public String confirmEmail {get;set;}
    
    public String phone {get;set;}
    
    public String mobile {get;set;}
    
    public String postcode {get;set;}
    
    public String state {get;set;}
    
    public String budget {get;set;}
    
    public String purchaseTimeframe {get;set;}
    
    public String desiredSuburb {get;set;}
    
    public String desiredState {get;set;}
    
    public String contactDuringBusinessHours {get;set;}
    
    public String whereDidYouHear {get;set;}
    
    public String candidateLeadSource {get;set;}
    
    public boolean termsAndConditionsAccepted {get;set;}
    
    public boolean getFranchiseOfInterestError()
    {
        return getError('franchiseOfInterest');
    }
    
    public boolean getFirstNameError()
    {
        return getError('firstName');
    }
    
    public boolean getSurnameError()
    {
        return getError('surname');
    }
    
    public boolean getEmailError()
    {
        return getError('email');
    }
    
    public boolean getConfirmEmailError()
    {
        return getError('confirmEmail');
    }
    
    public boolean getPhoneError()
    {
        return getError('phone');
    }
    
    public boolean getMobileError()
    {
        return getError('mobile');
    }
    
    public boolean getPostcodeError()
    {
        return getError('postcode');
    }
    
    public boolean getStateError()
    {
        return getError('state');
    }
    
    public boolean getBudgetError()
    {
        return getError('budget');
    }
    
    public boolean getPurchaseTimeFrameError()
    {
        return getError('purchaseTimeframe');
    }
    
    public boolean getDesiredSuburbError()
    {
        return getError('desiredSuburb');
    }
    
    public boolean getDesiredStateError()
    {
        return getError('desiredState');
    }
    
    public boolean getContactDuringBusinessHoursError()
    {
        return getError('contactDuringBusinessHours');
    }
    
    public boolean getWhereDidYouHearError()
    {
        return getError('whereDidYouHear');
    }
    
    public boolean getCandidateLeadSourceError()
    {
        return getError('candidateLeadSource');
    }
    
    public boolean getTermsAndConsitionsAcceptedERror()
    {
        return getError('termsAndConditionsAccepted');
    }
    
    private boolean getError(String error)
    {
        for(String errorKey : this.errors)
        {
            {
                if(errorKey.equals(error))
                {
                    return true;
                }
            }
        }
        return false;
    }
    
    static testMethod void testThis()
    {
        ContactDetails contactDetails = new ContactDetails();
        contactDetails.errors.add('test');
        System.assert(contactDetails.getError('test'));
        contactDetails.getBudgetError();
        contactDetails.getCandidateLeadSourceError();
        contactDetails.getConfirmEmailError();
        contactDetails.getDesiredStateError();
        contactDetails.getDesiredSuburbError();
        contactDetails.getEmailError();
        contactDetails.getErrors();
        contactDetails.getFirstNameError();
        contactDetails.getFranchiseOfInterestError();
        contactDetails.getPostcodeError();
        contactDetails.getHasValidationErrors();
        contactDetails.getMobileError();
        contactDetails.getPhoneError();
        contactDetails.getPurchaseTimeFrameError();
        contactDetails.getStateError();
        contactDetails.getStateError();
        contactDetails.getSurnameError();
        contactDetails.getWhereDidYouHearError();
        contactDetails.getTermsAndConsitionsAcceptedError();
    }
    
}